home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1997
/
HAM Radio 1997.iso
/
vcls
/
moden
/
adstatlt.int
< prev
next >
Wrap
Text File
|
1996-04-08
|
8KB
|
249 lines
{$G+,X+,F+}
{Conditional defines that may affect this unit}
{$I AWDEFINE.INC}
{*********************************************************}
{* ADSTATLT.PAS 1.01 *}
{* Copyright (c) TurboPower Software 1995 *}
{* All rights reserved. *}
{*********************************************************}
unit AdStatLt;
{-Port status light component}
interface
uses
{------RTL}
WinTypes,
WinProcs,
SysUtils,
Classes,
Controls,
Graphics,
Forms,
{------APD}
Dialogs,
OoMisc,
AdPort;
const
DefLightDim = 13;
const
DefErrorOffTimeout = 36;
DefBreakOffTimeout = 36;
DefRXDOffTimeout = 1;
DefTXDOffTimeout = 1;
DefRingOffTimeout = 8;
DefLitColor = clRed;
DefNotLitColor = clGreen;
type
TApdCustomStatusLight = class(TGraphicControl)
protected {private}
{.Z+}
FGlyph : TBitmap;
FLit : Boolean;
FLitColor : TColor;
FNotLitColor : TColor;
HaveGlyph : Boolean;
procedure SetGlyph(const NewGlyph : TBitmap);
{-Set the bitmap displayed for the light}
procedure SetLit(const IsLit : Boolean);
{-Set whether the light is lit or not}
procedure SetLitColor(const NewColor : TColor);
{-Set the color the light is displayed in when it is lit}
procedure SetNotLitColor(const NewColor : TColor);
{-Set the color the light is displayed in when it is not lit}
procedure SetBounds(ALeft, ATop, AWidth, AHeight : Integer); override;
procedure Paint; override;
procedure Loaded; override;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
{.Z-}
property Glyph : TBitmap
read FGlyph write SetGlyph;
property Lit : Boolean
read FLit write SetLit;
property LitColor : TColor
read FLitColor write SetLitColor default DefLitColor;
property NotLitColor : TColor
read FNotLitColor write SetNotLitColor default DefNotLitColor;
end;
TApdStatusLight = class(TApdCustomStatusLight)
published
property Glyph;
property Lit;
property LitColor;
property NotLitColor;
end;
TLightSet = class(TPersistent)
protected {private}
{.Z+}
FCTSLight : TApdCustomStatusLight;
FDSRLight : TApdCustomStatusLight;
FDCDLight : TApdCustomStatusLight;
FRINGLight : TApdCustomStatusLight;
FTXDLight : TApdCustomStatusLight;
FRXDLight : TApdCustomStatusLight;
FERRORLight : TApdCustomStatusLight;
FBREAKLight : TApdCustomStatusLight;
public
constructor Create;
{.Z-}
procedure InitLights(const ComPort : TApdCustomComPort);
published
property CTSLight : TApdCustomStatusLight
read FCTSLight write FCTSLight;
property DSRLight : TApdCustomStatusLight
read FDSRLight write FDSRLight;
property DCDLight : TApdCustomStatusLight
read FDCDLight write FDCDLight;
property RINGLight : TApdCustomStatusLight
read FRINGLight write FRINGLight;
property TXDLight : TApdCustomStatusLight
read FTXDLight write FTXDLight;
property RXDLight : TApdCustomStatusLight
read FRXDLight write FRXDLight;
property ERRORLight : TApdCustomStatusLight
read FERRORLight write FERRORLight;
property BREAKLight : TApdCustomStatusLight
read FBREAKLight write FBREAKLight;
end;
TApdCustomSLController = class(TComponent)
protected {private}
{.Z+}
{port stuff}
FComPort : TApdCustomComPort;
FMonitoring : Boolean;
{timeouts}
FErrorOffTimeout : LongInt;
FBreakOffTimeout : LongInt;
FRXDOffTimeout : LongInt;
FTXDOffTimeout : LongInt;
FRingOffTimeout : LongInt;
{lights}
FLights : TLightSet;
{saved event handlers}
SaveTriggerAvail : TTriggerAvailEvent; {Old data available trigger}
SaveTriggerStatus : TTriggerStatusEvent; {Old status trigger handler}
SaveTriggerTimer : TTriggerTimerEvent; {Old timer trigger handler}
{trigger handles}
ModemStatMask : Word; {Status bits we want to watch}
MSTrig : Integer; {Modem status indicator trigger}
ErrorOnTrig : Integer; {ERROR indicator turn on trigger}
BreakOnTrig : Integer; {BREAK indicator turn on trigger}
ErrorOffTrig : Integer; {ERROR indicator turn off trigger}
BreakOffTrig : Integer; {BREAK indicator turn off trigger}
RxdOffTrig : Integer; {RXD indicator turn off trigger}
TxdOnTrig : Integer; {TXD indicator turn on trigger}
TxdOffTrig : Integer; {TXD indicator turn off trigger}
RingOffTrig : Integer; {RING indicator turn off trigger}
function GetHaveCTSLight : Boolean;
function GetHaveDSRLight : Boolean;
function GetHaveDCDLight : Boolean;
function GetHaveRINGLight : Boolean;
function GetHaveTXDLight : Boolean;
function GetHaveRXDLight : Boolean;
function GetHaveERRORLight : Boolean;
function GetHaveBREAKLight : Boolean;
procedure SetComPort(const NewPort : TApdCustomComPort);
procedure SetLights(const NewLights : TLightSet);
procedure SetMonitoring(const NewMon : Boolean);
procedure Notification(AComponent : TComponent; Operation: TOperation); override;
procedure InitTriggers;
{-Set trigger handles to their default values}
procedure AddTriggers;
{-Add triggers to com port}
procedure RemoveTriggers;
{-Remove triggers from com port}
procedure InitLights;
{-Initialize the default statuses of various modem lights}
procedure CheckLight(const CurStat : Boolean; const Light : TApdCustomStatusLight);
{-See if a light has changed and update it if so}
{replacement trigger handlers}
procedure StatTriggerAvail(CP : TObject; Count : Word);
procedure StatTriggerStatus(CP : TObject; TriggerHandle : Word);
procedure StatTriggerTimer(CP : TObject; TriggerHandle : Word);
procedure StatPortClose(CP : TObject; Opening : Boolean); {!!.01}
property HaveCTSLight : Boolean
read GetHaveCTSLight;
property HaveDSRLight : Boolean
read GetHaveDSRLight;
property HaveDCDLight : Boolean
read GetHaveDCDLight;
property HaveRINGLight : Boolean
read GetHaveRINGLight;
property HaveTXDLight : Boolean
read GetHaveTXDLight;
property HaveRXDLight : Boolean
read GetHaveRXDLight;
property HaveERRORLight : Boolean
read GetHaveERRORLight;
property HaveBREAKLight : Boolean
read GetHaveBREAKLight;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
{.Z-}
property Monitoring : Boolean
read FMonitoring write SetMonitoring;
{port to monitor}
property ComPort : TApdCustomComPort
read FComPort write SetComPort;
{timeout values}
property ErrorOffTimeout : LongInt
read FErrorOffTimeout write FErrorOffTimeout default DefErrorOffTimeout;
property BreakOffTimeout : LongInt
read FBreakOffTimeout write FBreakOffTimeout default DefBreakOffTimeout;
property RXDOffTimeout : LongInt
read FRXDOffTimeout write FRXDOffTimeout default DefRXDOffTimeout;
property TXDOffTimeout : LongInt
read FTXDOffTimeout write FTXDOffTimeout default DefTXDOffTimeout;
property RingOffTimeout : LongInt
read FRingOffTimeout write FRingOffTimeout default DefRingOffTimeout;
{complete set of lights}
property Lights : TLightSet
read FLights write SetLights;
end;
TApdSLController = class(TApdCustomSLController)
published
property ComPort;
property ErrorOffTimeout;
property BreakOffTimeout;
property RXDOffTimeout;
property TXDOffTimeout;
property RingOffTimeout;
property Lights;
end;